package com.mrx.example.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mrx.example.dao.DeptDao;
import com.mrx.example.servlet.BaseServlet;

@WebServlet(name = "获取部门信息 API", value = "/dept")
public class DeptController extends BaseServlet {

    private static final DeptDao dao = new DeptDao();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        sendModelResponse(resp, dao.findAllDepts());
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        sendModelResponse(resp, dao.findAllDepts());
    }
}
